-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Feat] Add Lasso Guardrail to LiteLLM #11565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* first version of lasso guardrail in litellm * update to the new Lasso API * change prod api_base and kill the request when lasso detect issue. * change test for now api, local test pass * add async tests * all tests pass * add docs for the new lasso guardrail * Remove support for modes other than pre_call in Lasso guardrail * code structure and naming * only pre_call docs * fix lint errors * move test to the new location follows the same directory structure as litellm/.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds initial support for the Lasso Security guardrail into LiteLLM, complete with first‐party integration code, tests, and documentation.
- Introduce
LassoGuardrail
hook, registry, and initializer - Add async and sync tests for Lasso pre‐call guardrail behavior
- Update docs and sidebar for Lasso guardrail and add model backup entry
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/litellm/proxy/guardrails/guardrail_hooks/test_lasso.py | New unit tests for async and sync pre‐call logic |
tests/guardrails_tests/test_lasso_guardrails.py | Duplicate of above tests in alternate folder |
litellm/types/guardrails.py | Add LASSO to supported integrations enum |
litellm/proxy/guardrails/guardrail_registry.py | Register initialize_lasso in the registry |
litellm/proxy/guardrails/guardrail_initializers.py | Implement initialize_lasso initializer |
litellm/proxy/guardrails/guardrail_hooks/lasso.py | Core LassoGuardrail implementation |
docs/my-website/sidebars.js | Include Lasso guardrail in sidebar navigation |
docs/my-website/docs/proxy/guardrails/lasso_security.md | Detailed Quick Start and examples for Lasso |
Comments suppressed due to low confidence (4)
tests/guardrails_tests/test_lasso_guardrails.py:1
- [nitpick] These tests largely duplicate those in
tests/litellm/proxy/guardrails/guardrail_hooks/test_lasso.py
. Consider consolidating or removing one copy to avoid redundancy.
import os
tests/litellm/proxy/guardrails/guardrail_hooks/test_lasso.py:34
- This test only ensures that initialization does not error, but does not assert that the
LassoGuardrail
callback was actually registered. Add an assertion to verify the callback is present inlitellm.callbacks
.
def test_lasso_guard_config():
docs/my-website/docs/proxy/guardrails/lasso_security.md:26
- The Quick Start YAML example omits
default_on: true
, which is required by the initializer. Adddefault_on: true
under thelitellm_params
block for consistency.
mode: "pre_call"
docs/my-website/docs/proxy/guardrails/lasso_security.md:90
- The example curl in the docs calls
https://server.lasso.security/gateway/v1/chat
, but the defaultapi_base
in code is.../gateway/v2/classify
. Update the docs to reference the correct endpoint or note the version difference.
"guardrails": ["lasso-guard"]
@@ -187,3 +188,26 @@ def initialize_pangea(litellm_params, guardrail): | |||
litellm.logging_callback_manager.add_litellm_callback(_pangea_callback) | |||
|
|||
return _pangea_callback | |||
|
|||
|
|||
def initialize_lasso(litellm_params, guardrail): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initialize_lasso
function registers the callback but doesn’t return it. To match other initializers and ensure callers receive the created LassoGuardrail
instance, add return _lasso_callback
at the end of the if
block.
Copilot uses AI. Check for mistakes.
* Feature/lasso guardrail (BerriAI#9002) * first version of lasso guardrail in litellm * update to the new Lasso API * change prod api_base and kill the request when lasso detect issue. * change test for now api, local test pass * add async tests * all tests pass * add docs for the new lasso guardrail * Remove support for modes other than pre_call in Lasso guardrail * code structure and naming * only pre_call docs * fix lint errors * move test to the new location follows the same directory structure as litellm/. * add lasso guard * docs lasso docs * add lasso guardrail * fix lasso guardrail --------- Co-authored-by: oroxenberg <oro@lasso.security>
* Feature/lasso guardrail (BerriAI#9002) * first version of lasso guardrail in litellm * update to the new Lasso API * change prod api_base and kill the request when lasso detect issue. * change test for now api, local test pass * add async tests * all tests pass * add docs for the new lasso guardrail * Remove support for modes other than pre_call in Lasso guardrail * code structure and naming * only pre_call docs * fix lint errors * move test to the new location follows the same directory structure as litellm/. * add lasso guard * docs lasso docs * add lasso guardrail * fix lasso guardrail --------- Co-authored-by: oroxenberg <oro@lasso.security>
[Feat] Add Lasso Guardrail to LiteLLM
Adds initial support for the Lasso Security guardrail into LiteLLM, complete with first‐party integration code, tests, and documentation.
first version of lasso guardrail in litellm
update to the new Lasso API
change prod api_base and kill the request when lasso detect issue.
change test for now api, local test pass
add async tests
all tests pass
add docs for the new lasso guardrail
Remove support for modes other than pre_call in Lasso guardrail
code structure and naming
only pre_call docs
fix lint errors
move test to the new location follows the same directory structure as litellm/.
Title
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/
directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit
Type
🆕 New Feature
✅ Test
Changes